package com.base.push.action;

import static com.base.common.GlobaConstants.ACTION_RESULT_DATA;
import static com.base.common.GlobaConstants.ASYNCHRONOUS;
import static com.base.common.GlobaConstants.CONTENT_TYPE;
import static com.base.common.GlobaConstants.CONTENT_TYPE_JSON;
import static com.base.common.GlobaConstants.JSON;
import static com.base.common.GlobaConstants.ROOT;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.base.common.action.AbstractBaseAction;
import com.base.common.bean.ActionResult;
import com.base.push.service.PushConfigService;
import com.cjy.common.bean.OpAttributes;

/**
 * 程序软件管理
 * 
 * @author Administrator
 *
 */

@Action("pushConfigAction")
@Results({ @Result(name = ASYNCHRONOUS, type = JSON, params = { ROOT,
		ACTION_RESULT_DATA, CONTENT_TYPE, CONTENT_TYPE_JSON }) })
public class PushConfigAction extends AbstractBaseAction {

	private static final long serialVersionUID = 1L;

	@Resource
	private PushConfigService pushConfigService;
	private String code;
	private String clientId;
	private int bid;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public int getBid() {
		return bid;
	}

	public void setBid(int bid) {
		this.bid = bid;
	}

	public String updateClientId() {

		try {
			actionResult = new ActionResult(new OpAttributes().add("code",
					pushConfigService.updateClientId(code, clientId, bid)));
		} catch (Exception e) {
			e.printStackTrace();
			actionResult = new ActionResult(new OpAttributes().add("code", 0));
		}
		return returnType();
	}

}
